Skip to content

fix(pptx): background rendering - gradient inheritance and page fill reset#188

Merged
developer0hye merged 4 commits into
developer0hye:mainfrom
nikith-18161:fix/pptx-background-rendering
Jul 19, 2026
Merged

fix(pptx): background rendering - gradient inheritance and page fill reset#188
developer0hye merged 4 commits into
developer0hye:mainfrom
nikith-18161:fix/pptx-background-rendering

Conversation

@nikith-18161

@nikith-18161 nikith-18161 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Preserves nikith-18161's original PR #188 commit while adapting it to current main:

  • keep the current layer-aware slide/layout/master gradient inheritance
  • keep the current theme fill-style resolution for bgRef
  • add the one contributor fix still missing on current main: explicitly reset a background-less slide to white instead of inheriting the previous Typst page fill
  • enable the three real-file PR fix(pptx): background rendering - gradient inheritance and page fill reset #188 acceptance scenarios

The original contributor commit remains in the PR history. The older gradient and bgRef changes were not replayed over the newer, more complete implementation already on main.
The PR base was refreshed to current main before final validation.

Related issue

Related: #188

Testing

  • cargo test --offline -p office2pdf --test pptx_fixtures pr_188 -- --nocapture — 3 passed
  • cargo test --offline -p office2pdf --lib — 1,204 passed during the focused adaptation
  • cargo test --offline --workspace --quiet — all suites passed, including 1,232 unit tests, 173 DOCX fixtures, 97 PPTX fixtures, 149 XLSX fixtures, 15 CLI tests, and doctests
  • cargo clippy --offline --workspace --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • python3 -m unittest scripts.tests.test_check_visual_pr — 9 passed

Visual impact

  • No rendered PDF change
  • Rendered PDF change or visual evidence added
  • Reason: Slide 2 now resets from slide 1's red background to the source presentation's white page.

Visual audit

  • Issue: fix(pptx): background rendering - gradient inheritance and page fill reset #188
  • Fixture: tests/fixtures/pptx/pr_188_page_fill_reset.pptx
  • Page(s): 2 (page count/order checked across both slides)
  • Renderer and DPI: pdftoppm, 150 DPI
  • Evidence mode: fix
  • New follow-up issues found in this audit: None
  • GT: assets/bugfixes/issue-188/gt.jpg
  • Before: assets/bugfixes/issue-188/before.jpg
  • After: assets/bugfixes/issue-188/after.jpg
Ground truth (PowerPoint) Before #188 After #188
PowerPoint ground truth Before After

Required inspection

  • Rendered all evidence at 150 DPI or higher
  • Stored progressive JPEG quality 86 assets with metadata stripped
  • Inspected matched region crops at full resolution
  • Ran the 5% fuzz pixel-difference sweep
  • Inventoried hairlines and border dash styles
  • Inventoried font weight, italic, and underline emphasis

Deviation audit

Check Result
Page count/order Matches GT: two 720 x 405 pt slides in source order
Element presence Matches GT: rounded panel, title, and subtitle are present on slide 2
Position/size Matches GT: panel geometry and text placement match; raster bounds differ by at most two antialiasing pixels
Rotation/flip No deviation observed
Fill Fixed: slide 2 resets to white instead of inheriting slide 1's red page fill
Stroke/border Matches GT: the rounded panel has the 1.5 pt solid gray outline; no visible element at or below 1 pt exists
Text content Matches GT
Font family/weight/style Matches GT: the title remains bold; no italic or underlined runs exist
Text color Matches GT
Alignment Matches GT: both text runs remain centered
Line/paragraph spacing Matches GT
Clipping/overflow No deviation observed

The 5% fuzz pixel-difference sweep found 11,474 pixels (0.91% of the page). Every cluster is confined to matched text and rounded-border antialiasing edges; it does not indicate a missing, displaced, recolored, clipped, or differently styled element.

Checklist

  • Commits include a Signed-off-by line
  • PR scope contains one root cause
  • Remaining visual deviations each reference an open issue

…reset

Three PPTX background rendering bugs fixed:

1. resolve_slide_background: gradient background only checked the slide
   XML, never the layout or master. Solid color already walked the full
   slide -> layout -> master chain. Extended gradient lookup to follow
   the same inheritance chain so branded templates with gradients on
   the layout or master render correctly.

2. generate_fixed_page: when no background is defined, Typst's #set page
   without a fill inherits the previous page's fill. Slides with no
   background would show the prior slide's color/gradient. Fixed by
   explicitly setting fill: white when neither background_color nor
   background_gradient is present.

3. parse_background_color: only handled bgPr (explicit fill) and ignored
   bgRef (theme background reference), which is the standard way
   PowerPoint templates define master backgrounds. Added bgRef parsing
   so the placeholder color inside bgRef is resolved as the background
   color.

Signed-off-by: nikith-18161 <nikith.molaka@progentys.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>

# Conflicts:
#	crates/office2pdf/src/parser/pptx_slides.rs
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye
developer0hye merged commit 831c07a into developer0hye:main Jul 19, 2026
39 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants